package com.hjn.springboot.springbootservlet.config;

import com.hjn.springboot.springbootservlet.servlet.MyServlet02;
import com.hjn.springboot.springbootservlet.servlet.MyServlet03;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: huaijn
 * @create: 2022/4/30 9:18
 * @description: servlet的springboot配置类
 **/
@Configuration
public class ServletConfig {
    @Bean
    public ServletRegistrationBean myServletRegistrationBean(){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
        servletRegistrationBean.setServlet(new MyServlet02());
        servletRegistrationBean.addUrlMappings("/myservlet02");
        return servletRegistrationBean;
    }

    @Bean
    public ServletRegistrationBean myservlet03RegistrationBean(){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean();
        servletRegistrationBean.setServlet(new MyServlet03());
        servletRegistrationBean.addUrlMappings("/myservlet03");
        return  servletRegistrationBean;
    }
}
